/*
 *      logthread.h
 *
 *      Copyright 2012 David Vachulka <david@konstrukce-cad.com>
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 3 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */

#ifndef LOGTHREAD_H
#define LOGTHREAD_H

#include <fx.h>
#include "dxmessagechannel.h"
#include "dxtabitem.h"

class LogThread: public FXThread
{
public:
    LogThread(dxTabItem *parent, FXApp *app, FXString directory);
    
    /*
     * set true if thread for list log files
     */
    void setList(bool list) { m_list = list; }
    void setDirectory(FXString directory) { m_directory = directory; }
    dxStringArray getResult() { return m_result; }
protected:
    FXint run();
private:
    FXMessageChannel m_feedback;
    dxTabItem *m_parent;
    FXString m_directory;
    dxStringArray m_result;
    bool m_list;

    FXint listFiles();
    FXint loadLogLines();
};

#endif  /* LOGTHREAD_H */

